#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <set>

using namespace std;

string convert(int num, int base)
{
    string rtn;
    while (num > 0) {
//	cout << num%base << rtn;
	char ch = ('0' + num%base);
	rtn = ch + rtn;
//	cout << rtn;
	num /= base;
    }
    return rtn;
}

int main(int argc, char **argv)
{
    cout << convert(98, 7) << endl;
    cout << convert(99, 7) << endl;

}
